package com.caesar.prac_Lambda;

import java.util.ArrayList;
import java.util.function.Predicate;

/**
 * @author caesar
 * @date 2025/7/19
 * @Description:
 * @apiNote
 */
public class EmployeeSerice {
    private ArrayList<Employee2> all = new ArrayList<>();
    public void add(Employee2 emp){
        all.add(emp);
    }

    public ArrayList<Employee2> get(Predicate<Employee2> p){
        ArrayList<Employee2> result = new ArrayList<>();
        for (Employee2 emp : all) {
            if(p.test(emp)){
                result.add(emp);
            }
        }
        return result;
    }

}
